﻿using System;
using System.Collections.Generic;
using System.Text;

namespace CommonSLT
{
    /// <summary>
    /// MessageBox
    /// </summary>
    public static class MyDialog
    {
        private static MyDialogResult myDialogResult = MyDialogResult.OK;
        /// <summary>
        /// Handles the MyDialogEvent event of the frm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="CommonSLT.MyDialogEventArgs"/> instance containing the event data.</param>
        private static void frm_MyDialogEvent(object sender, MyDialogEventArgs e)
        {
            myDialogResult = e.myDialogResult;
        }

        /// <summary>
        /// Shows the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <returns></returns>
        public static MyDialogResult Show(string content)
        {
            MessageForm frm = new MessageForm(content);
            frm.MyDialogEvent += new MyDialogEventHandler(frm_MyDialogEvent);
            frm.ShowDialog();
            return myDialogResult;
        }

        /// <summary>
        /// Shows the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="caption">The caption.</param>
        /// <returns></returns>
        public static MyDialogResult Show(string content, string caption)
        {
            MessageForm frm = new MessageForm(content, caption);
            frm.MyDialogEvent += new MyDialogEventHandler(frm_MyDialogEvent);
            frm.ShowDialog();
            return myDialogResult;
        }

        /// <summary>
        /// Shows the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="caption">The caption.</param>
        /// <param name="myDialogButtons">My dialog buttons.</param>
        /// <returns></returns>
        public static MyDialogResult Show(string content, string caption, MyDialogButtons myDialogButtons)
        {
            MessageForm frm = new MessageForm(content, caption, myDialogButtons);
            frm.MyDialogEvent += new MyDialogEventHandler(frm_MyDialogEvent);
            frm.ShowDialog();
            return myDialogResult;
        }

        /// <summary>
        /// Shows the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="caption">The caption.</param>
        /// <param name="myDialogButtons">My dialog buttons.</param>
        /// <param name="myDialogFocus">My dialog focus.</param>
        /// <returns></returns>
        public static MyDialogResult Show(string content, string caption, MyDialogButtons myDialogButtons, MyDialogFocus myDialogFocus)
        {
            MessageForm frm = new MessageForm(content, caption, myDialogButtons, myDialogFocus);
            frm.MyDialogEvent += new MyDialogEventHandler(frm_MyDialogEvent);
            frm.ShowDialog();
            return myDialogResult;
        }

        /// <summary>
        /// Shows the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="caption">The caption.</param>
        /// <param name="myDialogButtons">My dialog buttons.</param>
        /// <param name="myDialogFocus">My dialog focus.</param>
        /// <param name="myDialogIcon">My dialog icon.</param>
        /// <returns></returns>
        public static MyDialogResult Show(string content, string caption, MyDialogButtons myDialogButtons, MyDialogFocus myDialogFocus, MyDialogIcon myDialogIcon)
        {
            MessageForm frm = new MessageForm(content, caption, myDialogButtons, myDialogFocus, myDialogIcon);
            frm.MyDialogEvent += new MyDialogEventHandler(frm_MyDialogEvent);
            frm.ShowDialog();
            return myDialogResult;
        }

        /// <summary>
        /// Shows the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="caption">The caption.</param>
        /// <param name="myDialogButtons">My dialog buttons.</param>
        /// <param name="myDialogIcon">My dialog icon.</param>
        /// <returns></returns>
        public static MyDialogResult Show(string content, string caption, MyDialogButtons myDialogButtons, MyDialogIcon myDialogIcon)
        {
            MessageForm frm = new MessageForm(content, caption, myDialogButtons, myDialogIcon);
            frm.MyDialogEvent += new MyDialogEventHandler(frm_MyDialogEvent);
            frm.ShowDialog();
            return myDialogResult;
        }
    }
}
